package com.potenza.training.interview.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.potenza.training.interview.dao.InterviewResultDao;
import com.potenza.training.interview.entity.InterviewResultEntity;
import com.potenza.training.interview.service.InterviewResultService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("interviewResultService")
public class InterviewResultServiceImpl extends ServiceImpl<InterviewResultDao, InterviewResultEntity> implements InterviewResultService {

    @Autowired
    InterviewResultDao interviewResultDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<InterviewResultEntity> page = this.page(
                new Query<InterviewResultEntity>().getPage(params),
                new QueryWrapper<InterviewResultEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public InterviewResultEntity findByInvitationId(Integer id) {
        QueryWrapper<InterviewResultEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(InterviewResultEntity::getInvitationId,id);
        return interviewResultDao.selectOne(queryWrapper);
    }

}